home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.applet.AudioClip;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Cursor;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import java.awt.event.MouseMotionListener;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.net.URLEncoder;
-
- public class Navigation extends Applet implements Runnable, MouseListener, MouseMotionListener {
- private Thread thread;
- // $FF: renamed from: wi int
- private int field_0;
- // $FF: renamed from: he int
- private int field_1;
- // $FF: renamed from: n int
- private int field_2 = 1;
- private boolean loaded = false;
- private Image[] image;
- private Image[] imagef;
- private int[] width;
- private int index;
- // $FF: renamed from: b java.awt.Graphics
- private Graphics field_3;
- private Image buffer;
- private boolean hor = true;
- private String statusBarText;
- private AudioClip sound;
- private AudioClip clicSound;
- private AudioClip enterSound;
- private boolean loopSound;
- // $FF: renamed from: fm java.awt.FontMetrics
- private FontMetrics field_4;
- private String enterText;
- private boolean isEnterTextEnabled;
- private int wiEnterText;
- private int enterTextHeight;
- private Color enterTextColor;
-
- public String getAppletInfo() {
- return "Name: Navigation\r\nAuthor: Taiji Software\r\n";
- }
-
- public Navigation() {
- ((Component)this).addMouseListener(this);
- ((Component)this).addMouseMotionListener(this);
- }
-
- public void register() {
- try {
- URL u = new URL("http://www.taijisoftware.com");
- ((Applet)this).getAppletContext().showDocument(u, "_blank");
- } catch (Exception e) {
- System.out.println(e);
- this.stop();
- }
- }
-
- public void init() {
- String codeBase = null;
-
- try {
- codeBase = (new URL(((Applet)this).getCodeBase().toString())).getHost();
- System.out.println("Copyright 1999, 2001 Taiji Software(tm)\nYour domain name is : " + codeBase);
- codeBase = codeBase.toUpperCase();
- } catch (Exception var9) {
- }
-
- if (!((Applet)this).getCodeBase().toString().toUpperCase().startsWith("FILE") || ((Applet)this).getParameter("debug") != null) {
- String regCode = ((Applet)this).getParameter("registration_code");
- if (regCode == null) {
- regCode = ((Applet)this).getParameter("reg_domain");
- if (regCode == null) {
- this.register();
- } else {
- if (regCode.length() == codeBase.length() + 4 && !codeBase.startsWith("WWW.")) {
- codeBase = "WWW." + codeBase;
- } else if (regCode.length() == codeBase.length() - 4 && codeBase.startsWith("WWW.")) {
- codeBase = codeBase.substring(4);
- }
-
- char[] chars = new char[codeBase.length()];
- codeBase.getChars(0, codeBase.length(), chars, 0);
- String key = new String("haricot");
- char[] chars2 = new char[key.length()];
- key.getChars(0, key.length(), chars2, 0);
-
- for(int i = 0; i < codeBase.length(); ++i) {
- int j;
- if (i >= key.length()) {
- j = i - key.length() * (i / key.length());
- } else {
- j = i;
- }
-
- chars[i] += chars2[j];
- chars[i] = (char)(chars[i] - chars[i] / 26 * 26 + 97);
- }
-
- String res = new String(chars);
- if (!res.equalsIgnoreCase(regCode)) {
- this.register();
- }
- }
- } else if (!regCode.equals("settevercsedegnamiaj") && !regCode.equals("8078")) {
- this.register();
- }
- }
-
- this.getParameters();
- if (this.sound != null) {
- if (this.loopSound) {
- this.sound.loop();
- return;
- }
-
- this.sound.play();
- }
-
- }
-
- public void getParameters() {
- this.field_0 = ((Component)this).getSize().width;
- this.field_1 = ((Component)this).getSize().height;
- String s = ((Applet)this).getParameter("number");
- if (s != null) {
- this.field_2 = Integer.parseInt(s);
- }
-
- s = ((Applet)this).getParameter("direction");
- if (s.equals("vertical")) {
- this.hor = false;
- }
-
- this.statusBarText = ((Applet)this).getParameter("status_bar_text");
- s = ((Applet)this).getParameter("sound_name");
- if (s != null) {
- this.sound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- s = ((Applet)this).getParameter("loop_sound");
- if (s != null) {
- if (s.equals("yes")) {
- this.loopSound = true;
- } else {
- this.loopSound = false;
- }
- }
-
- s = ((Applet)this).getParameter("clic_sound_name");
- if (s != null) {
- this.clicSound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- s = ((Applet)this).getParameter("enter_sound_name");
- if (s != null) {
- this.enterSound = ((Applet)this).getAudioClip(((Applet)this).getCodeBase(), s);
- }
-
- this.enterText = ((Applet)this).getParameter("enter_text");
- s = ((Applet)this).getParameter("enter_text_height");
- if (s != null) {
- this.enterTextHeight = Integer.parseInt(s);
- }
-
- this.enterTextColor = this.getColor("enter_text_color");
- if (this.enterTextColor == null) {
- this.enterTextColor = Color.white;
- }
-
- }
-
- public Color getColor(String param) {
- String s = ((Applet)this).getParameter(param);
- if (s != null) {
- if (s.substring(0, 1).equals("#")) {
- s = s.substring(1);
- int i = Integer.parseInt(s, 16);
- return new Color(i);
- } else {
- return null;
- }
- } else {
- return null;
- }
- }
-
- public void start() {
- if (this.thread == null) {
- this.thread = new Thread(this);
- this.thread.start();
- }
-
- }
-
- public void stop() {
- if (this.thread != null) {
- this.thread = null;
- }
-
- if (this.sound != null) {
- this.sound.stop();
- }
-
- }
-
- public void paint(Graphics g) {
- if (this.loaded) {
- int l = 0;
-
- for(int i = 0; i < this.field_2; ++i) {
- if (i != this.index) {
- if (this.hor) {
- this.field_3.drawImage(this.image[i], l, 0, this.width[i], this.field_1, this);
- } else {
- this.field_3.drawImage(this.image[i], 0, l, this.field_0, this.width[i], this);
- }
- } else if (this.hor) {
- this.field_3.drawImage(this.imagef[i], l, 0, this.width[i], this.field_1, this);
- } else {
- this.field_3.drawImage(this.imagef[i], 0, l, this.field_0, this.width[i], this);
- }
-
- l += this.width[i];
- }
-
- if (this.isEnterTextEnabled) {
- this.field_3.drawString(this.enterText, (this.field_0 - this.wiEnterText) / 2, this.field_1 / 2);
- }
-
- g.drawImage(this.buffer, 0, 0, this);
- }
-
- }
-
- public void run() {
- if (!this.loaded) {
- this.buffer = ((Component)this).createImage(this.field_0, this.field_1);
- this.field_3 = this.buffer.getGraphics();
- this.field_3.setColor(this.enterTextColor);
- String fontName = ((Applet)this).getParameter("enter_text_font");
- if (fontName == null) {
- fontName = "TimesRoman";
- }
-
- int style = 1;
- String s = ((Applet)this).getParameter("enter_text_style");
- if (s != null) {
- if (s.equals("bold")) {
- style = 1;
- } else if (s.equals("italic")) {
- style = 2;
- } else if (s.equals("bold_italic")) {
- style = 3;
- } else {
- style = 0;
- }
- }
-
- this.field_3.setFont(new Font(fontName, style, this.enterTextHeight));
- this.field_4 = this.field_3.getFontMetrics();
- if (this.enterText != null) {
- this.wiEnterText = this.field_4.stringWidth(this.enterText);
- }
-
- this.image = new Image[this.field_2];
- this.imagef = new Image[this.field_2];
- MediaTracker tracker = new MediaTracker(this);
-
- for(int i = 1; i <= this.field_2; ++i) {
- this.image[i - 1] = ((Applet)this).getImage(((Applet)this).getCodeBase(), ((Applet)this).getParameter("image" + Integer.toString(i)));
- this.imagef[i - 1] = ((Applet)this).getImage(((Applet)this).getCodeBase(), ((Applet)this).getParameter("image_focused" + Integer.toString(i)));
- }
-
- for(int i = 0; i < this.field_2; ++i) {
- tracker.addImage(this.image[i], 0);
- tracker.addImage(this.imagef[i], 0);
- }
-
- try {
- tracker.waitForAll();
- this.loaded = !tracker.isErrorAny();
- } catch (Exception e) {
- System.out.println(e);
- }
-
- if (!this.loaded) {
- this.stop();
- }
-
- this.width = new int[this.field_2];
-
- for(int i = 0; i < this.field_2; ++i) {
- if (this.hor) {
- this.width[i] = this.image[i].getWidth(this);
- } else {
- this.width[i] = this.image[i].getHeight(this);
- }
- }
- }
-
- this.repaint(-1);
- }
-
- public void repaint(int in) {
- this.index = in;
- ((Component)this).repaint();
- }
-
- public URL giveURL(String url) {
- try {
- if (url.toUpperCase().startsWith("HTTP")) {
- return new URL(url);
- } else if (url.toUpperCase().startsWith("FTP")) {
- int p = url.indexOf(":");
- int p2 = url.indexOf(":", p + 1);
- if (p2 != -1) {
- url = url.substring(0, p + 3) + URLEncoder.encode(url.substring(p + 3, url.length()));
- }
-
- p = url.indexOf("%40");
- if (p != -1) {
- url = url.substring(0, p) + "@" + url.substring(p + 3, url.length());
- }
-
- return new URL(url);
- } else {
- return new URL(((Applet)this).getCodeBase(), url);
- }
- } catch (MalformedURLException e) {
- System.out.println(e);
- return null;
- }
- }
-
- public void mouseClicked(MouseEvent e) {
- if (this.clicSound != null) {
- this.clicSound.play();
- }
-
- int l = 0;
- int xi;
- if (this.hor) {
- xi = e.getX();
- } else {
- xi = e.getY();
- }
-
- for(int i = 0; i < this.field_2; ++i) {
- if (xi > l & xi < l + this.width[i]) {
- try {
- String target = ((Applet)this).getParameter("target");
- if (target == null) {
- target = "_self";
- }
-
- ((Applet)this).getAppletContext().showDocument(this.giveURL(((Applet)this).getParameter("link" + Integer.toString(i + 1))), target);
- return;
- } catch (Exception ex) {
- System.out.println(ex);
- return;
- }
- }
-
- l += this.width[i];
- }
-
- }
-
- public void mouseEntered(MouseEvent e) {
- if (this.enterText != null) {
- this.isEnterTextEnabled = true;
- ((Component)this).repaint();
- }
-
- if (this.statusBarText != null) {
- ((Applet)this).showStatus(this.statusBarText);
- }
-
- if (this.enterSound != null) {
- this.enterSound.play();
- }
-
- ((Component)this).setCursor(new Cursor(12));
- }
-
- public void mouseExited(MouseEvent e) {
- this.repaint(-1);
- if (this.isEnterTextEnabled) {
- this.isEnterTextEnabled = false;
- ((Component)this).repaint();
- }
-
- ((Component)this).setCursor(new Cursor(0));
- }
-
- public void mousePressed(MouseEvent e) {
- }
-
- public void mouseReleased(MouseEvent e) {
- }
-
- public void mouseDragged(MouseEvent e) {
- }
-
- public void mouseMoved(MouseEvent e) {
- int l = 0;
- int xi;
- if (this.hor) {
- xi = e.getX();
- } else {
- xi = e.getY();
- }
-
- for(int i = 0; i < this.field_2; ++i) {
- if (xi > l & xi < l + this.width[i]) {
- if (i != this.index) {
- this.repaint(i);
- }
-
- return;
- }
-
- l += this.width[i];
- }
-
- }
- }
-